
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>mysql表设计 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="go的mysql操作.html" />
    
    
    <link rel="prev" href="http静态资源服务器.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="./">
            
                <a href="./">
            
                    
                    Part2 模拟商城
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="payflow.html">
            
                <a href="payflow.html">
            
                    
                    订单支付流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="goinstall.html">
            
                <a href="goinstall.html">
            
                    
                    go 语言环境安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="gomod.html">
            
                <a href="gomod.html">
            
                    
                    包管理工具 go mod
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="http.html">
            
                <a href="http.html">
            
                    
                    实现http服务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="http静态资源服务器.html">
            
                <a href="http静态资源服务器.html">
            
                    
                    http静态资源服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.6" data-path="mysql表设计.html">
            
                <a href="mysql表设计.html">
            
                    
                    mysql表设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="go的mysql操作.html">
            
                <a href="go的mysql操作.html">
            
                    
                    go的mysql操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="go的api接口实现.html">
            
                <a href="go的api接口实现.html">
            
                    
                    go的api接口实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../alipay/">
            
                <a href="../alipay/">
            
                    
                    Part3 接入支付宝
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="../alipay/flow.html">
            
                <a href="../alipay/flow.html">
            
                    
                    支付宝文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="../alipay/secret.html">
            
                <a href="../alipay/secret.html">
            
                    
                    密码学-非对称加密
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">扩展</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../plugins.md">
            
                <span>
            
                    
                    插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../themes.md">
            
                <span>
            
                    
                    主题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="../bookjson.md">
            
                <span>
            
                    
                    bookjson
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >mysql表设计</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="mysql&#x8868;&#x8BBE;&#x8BA1;">mysql&#x8868;&#x8BBE;&#x8BA1;</h2>
<h3 id="mysql&#x7684;&#x5B89;&#x88C5;">mysql&#x7684;&#x5B89;&#x88C5;</h3>
<h4 id="&#x76F4;&#x63A5;&#x5B89;&#x88C5;">&#x76F4;&#x63A5;&#x5B89;&#x88C5;</h4>
<p><strong>&#x4E0B;&#x8F7D;&#x5730;&#x5740;</strong>
&#x5728;&#x8BE5;&#x5730;&#x5740;&#x4E2D;&#x67E5;&#x627E;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF; windows&#x3001;macOS&#x3001;linux&#x5BF9;&#x5E94;&#x7684;&#x7248;&#x672C;&#x8FDB;&#x884C;&#x4E0B;&#x8F7D;&#x5373;&#x53EF;&#x3002;
<a href="https://dev.mysql.com/downloads/mysql/" target="_blank">https://dev.mysql.com/downloads/mysql/</a>
&#x9700;&#x8981;&#x5148;&#x6CE8;&#x518C;&#x5E76;&#x767B;&#x5F55;oracle&#x8D26;&#x6237;&#x624D;&#x53EF;&#x4EE5;&#x4E0B;&#x8F7D;&#x3002;</p>
<p><strong>&#x5B89;&#x88C5;&#x6307;&#x5357;</strong>
windows&#xFF1A;<br>
<a href="https://www.mysql.com/cn/why-mysql/white-papers/visual-guide-to-installing-mysql-windows-zh/" target="_blank">https://www.mysql.com/cn/why-mysql/white-papers/visual-guide-to-installing-mysql-windows-zh/</a>
macOS&#xFF1A;<br>
<a href="https://zhuanlan.zhihu.com/p/27960044" target="_blank">https://zhuanlan.zhihu.com/p/27960044</a>
linux:
&#x5728;linux&#x4E0B;&#x5B89;&#x88C5;mysql&#x7684;&#x65B9;&#x5F0F;&#x6BD4;&#x8F83;&#x591A;&#xFF0C;&#x6709;&#x4E9B;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x81EA;&#x5E26;&#x4E86;mysql&#xFF1B;&#x5728;linux&#x4E0B;&#x5B89;&#x88C5;&#x53EF;&#x4EE5;&#x81EA;&#x884C;&#x67E5;&#x627E;&#x76F8;&#x5173;&#x7684;&#x535A;&#x5BA2;&#xFF0C;&#x8FD9;&#x91CC;&#x4E5F;&#x7ED9;&#x51FA;&#x6765;&#x4E00;&#x4E2A;&#x53C2;&#x8003;&#x94FE;&#x63A5;<a href="https://www.runoob.com/mysql/mysql-install.html" target="_blank">https://www.runoob.com/mysql/mysql-install.html</a>&#x3002;</p>
<h4 id="docker">docker</h4>
<p>docker &#x662F;&#x865A;&#x62DF;&#x5316;&#x5BB9;&#x5668;&#x6280;&#x672F;&#xFF0C;&#x57FA;&#x4E8E;docker&#x53EF;&#x4EE5;&#x5FEB;&#x901F;&#x7684;&#x6784;&#x5EFA;&#x6807;&#x51C6;&#x5316;&#x7684;&#x8FD0;&#x884C;&#x73AF;&#x5883;&#x3002;
&#x8FD9;&#x91CC;&#x5C31;&#x505A;docker&#x7684;&#x8BE6;&#x7EC6;&#x4ECB;&#x7ECD;&#x4E86;&#xFF0C;&#x53EF;&#x4EE5;&#x53C2;&#x8003;&#x5982;&#x4E0B;&#x94FE;&#x63A5;&#x8FDB;&#x884C;&#x5B89;&#x88C5;&#x3002;
<a href="https://www.runoob.com/docker/docker-install-mysql.html" target="_blank">https://www.runoob.com/docker/docker-install-mysql.html</a></p>
<p>&#x6267;&#x884C;&#x5982;&#x4E0B;&#x547D;&#x4EE4;&#x5C31;&#x53EF;&#x4EE5;&#x8FD0;&#x884C;mysql:</p>
<pre><code>docker run -d --name mysql -v ~/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=yanwu12138 -p 3306:3306 mysql:5.7
</code></pre><p>&#x6267;&#x884C;&#x5982;&#x4E0B;&#x547D;&#x4EE4;&#x8FDB;&#x5165;&#x5230;docker&#x5BB9;&#x5668;&#x4E2D;&#xFF0C;&#x5E76;&#x8FDE;&#x63A5;mysql:</p>
<pre><code>docker exec -it mysql bash
root@ca0f4b520b81:/# mysql -h localhost -uroot -p123456
mysql&gt;
</code></pre><h3 id="&#x521B;&#x5EFA;&#x6570;&#x636E;&#x8868;">&#x521B;&#x5EFA;&#x6570;&#x636E;&#x8868;</h3>
<pre><code>mysql&gt;create database payment;

mysql&gt;use payment;

mysql&gt; CREATE TABLE `product_order` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `uid` bigint(20) NOT NULL DEFAULT &apos;0&apos;,
  `product_id` bigint(20) NOT NULL DEFAULT &apos;0&apos;,
  `pay_amount` bigint(20) NOT NULL DEFAULT &apos;0&apos;,
  `pay_status` tinyint(3) NOT NULL DEFAULT &apos;0&apos;,
  `create_time` int(10) NOT NULL DEFAULT &apos;0&apos;,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="http静态资源服务器.html" class="navigation navigation-prev " aria-label="Previous page: http静态资源服务器">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="go的mysql操作.html" class="navigation navigation-next " aria-label="Next page: go的mysql操作">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"mysql表设计","level":"1.2.6","depth":2,"next":{"title":"go的mysql操作","level":"1.2.7","depth":2,"path":"two_shop/go的mysql操作.md","ref":"two_shop/go的mysql操作.md","articles":[]},"previous":{"title":"http静态资源服务器","level":"1.2.5","depth":2,"path":"two_shop/http静态资源服务器.md","ref":"two_shop/http静态资源服务器.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"two_shop/mysql表设计.md","mtime":"2020-05-30T09:22:08.389Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-05-30T14:47:16.991Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

